<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>持续集成与持续部署：现代软件开发的核心实践</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        
        .text-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 8px;
            margin-top: 3px;
            font-weight: 700;
            color: #667eea;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .icon-box {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            font-size: 24px;
            margin-bottom: 1rem;
        }
        
        .timeline-item {
            position: relative;
            padding-left: 40px;
            margin-bottom: 2rem;
        }
        
        .timeline-item::before {
            content: '';
            position: absolute;
            left: 10px;
            top: 8px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #667eea;
        }
        
        .timeline-item::after {
            content: '';
            position: absolute;
            left: 15px;
            top: 20px;
            width: 2px;
            height: calc(100% + 20px);
            background: #e5e7eb;
        }
        
        .timeline-item:last-child::after {
            display: none;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">持续集成与持续部署</h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">现代软件开发的核心实践</p>
                <div class="flex justify-center space-x-8 text-lg">
                    <div class="flex items-center">
                        <i class="fas fa-code-branch mr-2"></i>
                        <span>频繁集成</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-rocket mr-2"></i>
                        <span>自动部署</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-shield-alt mr-2"></i>
                        <span>质量保证</span>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12">
        <!-- Introduction -->
        <section class="max-w-4xl mx-auto mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <p class="text-lg leading-relaxed text-gray-700">
                    <span class="first-letter">在</span>现代软件开发中，持续集成（CI）与持续部署（CD）已经成为提升开发效率和软件质量的重要实践。通过将这些实践应用于开发流程中，团队能够快速响应需求变化、提高代码质量、减少缺陷，并且提升产品交付的频率。
                </p>
            </div>
        </section>

        <!-- CI/CD Overview -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title">什么是持续集成（CI）与持续部署（CD）</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                    <div class="icon-box">
                        <i class="fas fa-code-merge"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4 text-gradient">持续集成 (CI)</h3>
                    <p class="text-gray-700 mb-4">开发人员将代码频繁地合并到主分支中，并通过自动化的构建与测试来验证每次提交的代码是否能够正常工作。</p>
                    <div class="space-y-3">
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>频繁的代码提交</strong>
                                <p class="text-sm text-gray-600">开发人员需要频繁地将代码提交到主分支，每次提交后都进行构建和测试。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>自动化构建</strong>
                                <p class="text-sm text-gray-600">系统会自动进行构建操作，确保代码可以正确编译。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>自动化测试</strong>
                                <p class="text-sm text-gray-600">确保新提交的代码没有引入新的错误或回归问题。</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                    <div class="icon-box">
                        <i class="fas fa-rocket"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4 text-gradient">持续部署 (CD)</h3>
                    <p class="text-gray-700 mb-4">将每次代码更新自动化地部署到生产环境，确保软件可以持续交付给用户。</p>
                    <div class="space-y-3">
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>自动化发布</strong>
                                <p class="text-sm text-gray-600">代码经过测试和验证后，自动部署到生产环境。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>生产环境监控</strong>
                                <p class="text-sm text-gray-600">对生产环境进行实时监控，及时发现并解决问题。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <div>
                                <strong>快速反馈</strong>
                                <p class="text-sm text-gray-600">快速获得用户反馈，进一步优化产品。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- CI/CD Workflow Visualization -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title">CI/CD 工作流程</h2>
            <div class="bg-white rounded-2xl shadow-lg p-8">
                <div class="mermaid">
                    graph LR
                        A[开发人员提交代码] --> B[代码仓库]
                        B --> C[自动化构建]
                        C --> D[自动化测试]
                        D --> E{测试通过?}
                        E -->|是| F[部署到测试环境]
                        E -->|否| G[通知开发人员]
                        F --> H[集成测试]
                        H --> I{集成测试通过?}
                        I -->|是| J[部署到生产环境]
                        I -->|否| G
                        J --> K[生产环境监控]
                        K --> L[用户反馈]
                        L --> A
                        style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                        style J fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                        style K fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                </div>
            </div>
        </section>

        <!-- Implementation Methods -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title">持续集成的实施方法</h2>
            <div class="space-y-6">
                <div class="timeline-item">
                    <div class="bg-white rounded-xl shadow-lg p-6">
                        <h3 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-tools text-purple-600 mr-3"></i>
                            配置自动化构建工具
                        </h3>
                        <p class="text-gray-700 mb-3">选择并配置合适的自动化构建工具，如 Jenkins、GitLab CI、Travis CI 等。这些工具可以在代码提交后自动执行构建任务。</p>
                        <div class="grid md:grid-cols-2 gap-4 mt-4">
                            <div class="bg-gray-50 rounded-lg p-4">
                                <strong class="text-purple-700">构建配置</strong>
                                <p class="text-sm text-gray-600 mt-1">确保自动化构建脚本能够正确地执行代码的构建、测试和部署任务。</p>
                            </div>
                            <div class="bg-gray-50 rounded-lg p-4">
                                <strong class="text-purple-700">依赖管理</strong>
                                <p class="text-sm text-gray-600 mt-1">使用 Maven、Gradle 等构建工具来管理项目的依赖，确保构建环境的一致性。</p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="timeline-item">
                    <div class="bg-white rounded-xl shadow-lg p-6">
                        <h3 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-vial text-purple-600 mr-3"></i>
                            编写自动化测试
                        </h3>
                        <p class="text-gray-700 mb-3">自动化测试是持续集成的核心环节。开发团队应编写单元测试、集成测试和端到端测试。</p>
                        <div class="grid md:grid-cols-3 gap-4 mt-4">
                            <div class="text-center">
                                <div class="w-16 h-16 mx-auto mb-2 bg-purple-100 rounded-full flex items-center justify-center">
                                    <i class="fas fa-cube text-purple-600"></i>
                                </div>
                                <strong>单元测试</strong>
                                <p class="text-sm text-gray-600 mt-1">验证每个函数和方法的正确性</p>
                            </div>
                            <div class="text-center">
                                <div class="w-16 h-16 mx-auto mb-2 bg-purple-100 rounded-full flex items-center justify-center">
                                    <i class="fas fa-puzzle-piece text-purple-600"></i>
                                </div>
                                <strong>集成测试</strong>
                                <p class="text-sm text-gray-600 mt-1">验证系统的各个模块协同工作</p>
                            </div>
                